﻿using JiveMessenger.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;




namespace JiveMessenger
{
    public class ContactGroupHeaderTemplateSelector : System.Windows.Controls.DataTemplateSelector
    {
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            CollectionViewGroup grp = (CollectionViewGroup)item;
            
            if (grp.Name is JiveFriendsGroupModel)
                return (container as FrameworkElement).FindResource("FriendsGroupTemplate") as DataTemplate;
            else if (grp.Name is JiveClientStatusGroupModel)
                return (container as FrameworkElement).FindResource("ClientStatusGroupTemplate") as DataTemplate;
            else
                return (container as FrameworkElement).FindResource("ChatGroupTemplate") as DataTemplate; 
        }
    }
}

